home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / MSG Demo 1.4.source Folder / Demo ƒ / Fades reversed ƒ / Four corner fade reversed.c < prev    next >
Text File  |  1994-04-15  |  3KB  |  89 lines

  1. /**********************************************************************\
  2.  
  3. File:        Four corner fade reversed.c
  4.  
  5. Purpose:    Graphic effect to fade main window to solid pattern.
  6.             See comments below for more description.
  7.  
  8. This program is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; either version 2 of the License, or
  11. (at your option) any later version.
  12.  
  13. This program is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. GNU General Public License for more details.
  17.  
  18. You should have received a copy of the GNU General Public License
  19. along with this program in a file named "GNU General Public License".
  20. If not, write to the Free Software Foundation, 675 Mass Ave,
  21. Cambridge, MA 02139, USA.
  22.  
  23. \**********************************************************************/
  24.  
  25. #include "timing.h"
  26.  
  27. #define CorrectTime 1
  28. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  29. #define theWindowWidth (boundsRect.right-boundsRect.left)
  30.  
  31. pascal short FourCornerFadeReversed(Rect boundsRect, Pattern *thePattern);
  32.  
  33. /* Take four rects, one at each corner, and make them bigger, growing on each
  34.    side of the screen.  This means lots of overlap copying, but the timing masks
  35.    it and Quickdraw may even take care of some of it. (?) */
  36.  
  37. pascal short FourCornerFadeReversed(Rect boundsRect, Pattern *thePattern)
  38. {
  39.     Rect        tl,tr,bl,br;
  40.     int            cx,cy;
  41.     int            VBarGap, HBarGap;
  42.     
  43.     VBarGap=theWindowWidth/100;
  44.     HBarGap=theWindowHeight/100;
  45.  
  46.     cx = boundsRect.left + theWindowWidth/2;
  47.     cy = boundsRect.top + theWindowHeight/2;
  48.     
  49.     tl.top=tr.top=boundsRect.top;
  50.     tl.left=bl.left=boundsRect.left;
  51.     tr.right=br.right=boundsRect.right;
  52.     bl.bottom=br.bottom=boundsRect.bottom;
  53.     
  54.     tl.right=tr.left=bl.right=br.left=cx;
  55.     tl.bottom=tr.bottom=bl.top=br.top=cy;
  56.     
  57.     while (tl.right>0)
  58.     {
  59.         tl.bottom-=HBarGap;
  60.         tr.bottom-=HBarGap;
  61.         bl.top+=HBarGap;
  62.         br.top+=HBarGap;
  63.         tl.right-=VBarGap;
  64.         tr.left+=VBarGap;
  65.         bl.right-=VBarGap;
  66.         br.left+=VBarGap;
  67.     }
  68.     
  69.     while (tl.right<cx)
  70.     {
  71.         StartTiming();
  72.         tl.bottom+=HBarGap;
  73.         tr.bottom+=HBarGap;
  74.         bl.top-=HBarGap;
  75.         br.top-=HBarGap;
  76.         tl.right+=VBarGap;
  77.         bl.right+=VBarGap;
  78.         tr.left-=VBarGap;
  79.         br.left-=VBarGap;
  80.         FillRect(&tl, *thePattern);
  81.         FillRect(&tr, *thePattern);
  82.         FillRect(&bl, *thePattern);
  83.         FillRect(&br, *thePattern);
  84.         TimeCorrection(CorrectTime);
  85.     }
  86.     
  87.     return 0;
  88. }
  89.